package org.spiderdesign.core.common;

public enum Department {
    xian             (1,"西安研发部"),

    beijing                 (2,"北京研发部");

    long code;
    String name;

    Department(long code, String name) {
        this.code = code;
        this.name = name;
    }

    public static String getName(long code){
        for (Department department : Department.values()) {
            if (department.code == code) {
                return department.name; // 匹配到则返回名称
            }
        }
        return null;
    }

    public static long getCode(String name){
        for (Department department : Department.values()) {
            if (department.name.equals(name)) {
                return department.code;
            }
        }
        return -1;
    }


}
